home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / DDJBSP2.ZIP / README.TXT
Encoding:
Text File  |  1995-11-04  |  4.9 KB  |  110 lines

  1. --start--
  2.  
  3. This archive contains the source code for a sample system to render
  4. 3-D scenes from 2-D BSP trees, as discussed in my "Ramblings in
  5. Realtime" column in the May/June, July/August, and November/December
  6. 1995 issues of _Dr. Dobb's Sourcebook_.  The archive contains the
  7. source code for BSPMAKER, a C++ program to generate 2D BSP trees from
  8. input line segment lists, and MAZE, a C program to allow first-person
  9. 3-D viewing of those trees in realtime.  Both programs are Win32
  10. programs, tested with VC++ 2.0 running on Windows NT 3.5.
  11.  
  12. To make the VC++ projects for these two programs, just unzip this
  13. archive into a directory using the -d option to pkunzip.  This will
  14. create two subdirectories, BSPMAKER and MAZE.  Have VC++ build two
  15. projects, one from the files in each directory.  Besides the source
  16. code, there is a sample BSP tree to view, several sample input line
  17. segment files, and the Win32 executables, bspmaker.exe and maze.exe,
  18. in the respective WinDebug subdirectories.
  19.  
  20. To run the BSP compiler, make BSPMAKER the current directory and type
  21.  
  22. windebug\bspmaker
  23.  
  24. Then load one of the .lin files, and compile and save as desired.
  25.  
  26. To run the BSP-based animation, make MAZE the current directory and
  27. type
  28.  
  29. windebug\maze
  30.  
  31. The BSP tree in bsptree.txt will be displayed.
  32.  
  33. BSPMAKER
  34. ========
  35. The UI is simple and self-explanatory; you can load a line file, and
  36. can compile either either one split at a time with visual feedback as
  37. to where the splitting is happening, at a paced speed with visual
  38. feedback, or as quickly as possible with no feedback.
  39.  
  40. You can save the compiled BSP tree to any file, but in order to view
  41. it with the MAZE program, you must save it to the file bsptree.txt in
  42. the directory that is current when MAZE is run.
  43.  
  44. MAZE ==== MAZE automatically displays the BSP tree stored in the file
  45. bsptree.txt in the directory that is current when MAZE is run.  The
  46. arrow keys move the viewpoint forward, backward, and turn right or
  47. left; the minus key moves the viewpoint up and the plus key moves the
  48. viewpoint down. There is no way to tilt the viewing angle up or down.
  49.  
  50. SAMPLE FILES
  51. ============
  52. The MAZE directory contains the sample BSP file bsptree.txt, which is
  53. compiled from the line file test.lin in the BSPMAKER directory.  This
  54. BSP tree is displayed automatically when you run MAZE.
  55. Sample line files in the BSPMAKER directory are:
  56.  
  57. test2.lin: a very simple four-line case
  58. test.lin: a fairly simple case designed to look a bit like a real
  59.           level
  60. mike.lin: a fairly complex case with the level spelling out "Hi Mike"
  61. hand.lin: a complex case with the level in the shape of a hand
  62.  
  63. One important thing to keep in mind is that walls face in a
  64. direction, and are only visible from one side.  This means that if
  65. you walk around to the other side of a visible wall, it will vanish. 
  66. This is the way real game levels work, where walls have volume, and
  67. you only see the outside of the polygons bounding the volume. 
  68. Test.lin looks more realistic than the other levels because I've
  69. inserted pairs of collinear polygons for the walls, one facing in
  70. each direction, so the wall are visible from both sides.  In a real
  71. game, the walls would be separated by some distance, and there would
  72. be top and bottom surfaces to make the walls volumes rather than
  73. flat, 2-D planes.  Note that the collinear walls can be confusing
  74. when you do a visual compile of test.lin, because it appears that the
  75. same wall is compiled multiple times.  It's not the same wall,
  76. though, it's another wall that's collinear with the first wall that
  77. was compiled.  In a production BSP compiler, collinear walls would
  78. share a single BSP node, for compactness and efficiency, and to avoid
  79. problems that can arise from collinear BSP splits.
  80.  
  81. NOTES
  82. =====
  83. Please note that these programs are provided totally "as-is."  I am
  84. well aware that the UI is crude and probably has some bugs, that the
  85. visualization could stand some improvement as well, that there
  86. certainly should be a built-in line-segment editor, and that the
  87. animation could be much faster, especially if it used DirectDraw, but
  88. that's not really what this archive is about.  The object of this
  89. particular archive is primarily to provide working 2D BSP code for
  90. people to learn from, and to provide visual feedback to make it
  91. easier to understand how BSPs work, and secondarily to provide a
  92. skeleton upon which a full-featured BSP compiler and BSP-based
  93. rendering system could be built. Please feel free to improve upon
  94. this program in any way you wish, and to use this code for any
  95. purpose, although acknowledgement is always appreciated. Please DON'T
  96. send me mail or disks or email telling me about your improvements; I
  97. just don't have time to read them; instead, post your comments and
  98. code on the net, for example in rec.games.programmer.
  99.  
  100. Thanks to Chris Hecker and John Carmack for their help.
  101.  
  102. Enjoy!
  103.  
  104. Michael Abrash
  105. mikeab@idsoftware.com
  106. 11/4/95
  107.  
  108. --end--
  109.  
  110.